<?php
/**
 * ...
 *
 */
class TBAlertWidget extends CWidget
{
protected $message;
protected $moduleName;
public $title;
public $cssClass;

    public function init()
    {
        $this->moduleName = ucfirst(Yii::app()->controller->module->id);
        if(Yii::app()->user->hasFlash('success'))
        {
            $this->message = Yii::app()->user->getFlash('success');
        }

        if(!isset($this->title))
        {
            $this->title = Yii::t($this->moduleName.'Module.base','Message');
        }
        else
        {
            $this->title = Yii::t($this->moduleName.'Module.base',$this->title);
        }

        if(!isset($this->cssClass))
        {
            $this->cssClass = 'alert alert-success alert-dismissable';
        }
    }
    public function run()
    {
        if(isset($this->message))
        {
            $alert = CHtml::openTag('div',array('class'=>$this->cssClass));
            $alert .= CHtml::htmlButton('&times;',array('class'=>'close','data-dismiss'=>'alert','aria-hidden'=>'true'));
            $alert .= CHtml::openTag('strong',array('style'=>'font-size:14px;padding-left:5px;padding-right:5px'));
            $alert .= $this->title;
            $alert .= '!';
            $alert .= CHtml::closeTag('strong');
            $alert .= $this->message;
            $alert .= CHtml::closeTag('div');
            echo  $alert;
        }
    }
}